﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Device.Location;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace Phone7ActionPack.BingMaps
{
    public class LocationCollectionControl : Phone7ActionPack.Controls.LocationControl
    {
        private Microsoft.Maps.MapControl.LocationCollection locationCollection = new Microsoft.Maps.MapControl.LocationCollection();
        public Microsoft.Maps.MapControl.LocationCollection LocationCollection
        {
            get { return this.locationCollection; }
            set
            {
                if (this.locationCollection != value)
                {
                    this.locationCollection = value;
                    this.OnPropertyChanged("LocationCollection");
                }
            }
        }
        protected override void OnGeoCoordinateChanged()
        {
            locationCollection.Add(new SimpleLocation(this.Latitude, this.Longitude));
        } 
    }
    public class SimpleLocation : Microsoft.Maps.MapControl.Location
    {
        public SimpleLocation(double lat, double log)
            :base(lat,log)
        { 
            
        }
        public string Location
        {
            get { return String.Format("{0},{1}", Latitude, Longitude); }
        } 
    }
}